package com.foodchain.repository;

import com.foodchain.entity.SystemSetting;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface SystemSettingRepository extends JpaRepository<SystemSetting, String>, JpaSpecificationExecutor<SystemSetting> {

    @Modifying
    @Query(value = "update SystemSetting set value = ?1 where id = ?2")
    void updateKeyValue(String value, String id);

    SystemSetting findByKey(String key);
}
